package com.sunni.aop;

import org.aspectj.lang.ProceedingJoinPoint;

/*切面类  包含:通知方法  --或者说 通知方法写在切面类*/
public class MyAspect {

    /*day09-10 : 前置通知*/
    public void before(){
        System.out.println("MyAspect : before running...");
    }

    /*day09-10 : 后置通知*/
    public void after_returning(){
        System.out.println("MyAspect : after_returning running...");
    }

    /*day09-10 : 环绕通知*/
    public Object around(ProceedingJoinPoint proceedingJoinPoint /*正在执行的连接点 正在进行配置的切点*/) throws Throwable {
        System.out.println("MyAspect : around before running..."); // 环绕-前
        Object proceed = proceedingJoinPoint.proceed(); // 切点 目标方法
        System.out.println("MyAspect : around after running..."); // 环绕-后
        return proceed;
    }

    /*day09-10 : 异常通知*/
    public void after_throwing(){
        System.out.println("MyAspect : after-throwing running...");
    }

    /*day09-10 : 都会通知*/
    public void after(){
        System.out.println("MyAspect : after running...");
    }
}
